package cn.ld.module.ai.dal.mapper.write;

import cn.ld.framework.common.pojo.PageResult;
import cn.ld.framework.mybatis.core.mapper.BaseMapperX;
import cn.ld.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ld.module.ai.controller.admin.write.vo.AiWritePageInVO;
import cn.ld.module.ai.dal.entity.write.AiWriteEntity;
import org.apache.ibatis.annotations.Mapper;

/**
 * AI 写作 Mapper
 *
 * @author xiaoxin
 */
@Mapper
public interface AiWriteMapper extends BaseMapperX<AiWriteEntity> {

    default PageResult<AiWriteEntity> selectPage(AiWritePageInVO inVO) {
        return selectPage(inVO, new LambdaQueryWrapperX<AiWriteEntity>()
                .eqIfPresent(AiWriteEntity::getUserId, inVO.getUserId())
                .eqIfPresent(AiWriteEntity::getType, inVO.getType())
                .eqIfPresent(AiWriteEntity::getPlatform, inVO.getPlatform())
                .betweenIfPresent(AiWriteEntity::getCreateTime, inVO.getCreateTime())
                .orderByDesc(AiWriteEntity::getId));
    }

}
